#include <stdio.h>
#include <string.h>

int main(int argc ,char **argv)
{
	FILE *fp;
	char str[81];

	if (argc != 2)
	{
		printf("fail!\n");
		return 1;
	}

	fp = fopen(argv[1],"w");
	if (NULL == fp)
	{
		printf ("open1 fail\n");
		return 1;
	}

	while(1)
	{
		char *p = gets(str);
		int len = strlen(p);
		if (len <= 0)	break;
		fputs(str,fp);
		fputc('\n',fp);

	} 	
	fclose(fp);

	fp = fopen(argv[1],"r");
	if (NULL == fp)
	{
		printf ("open2 fail\n");
		return 1;
	}

	while (fgets(str,81,fp) != NULL)
		fputs(str,stdout);
	fclose(fp);
	return 0;
}